home *** CD-ROM | disk | FTP | other *** search
- /*
- IXStringSearch.h - Copyright (c) 1992 NeXT Computer, Inc.
-
- You may freely copy, distribute and reuse the code in this example.
- NeXT Computer, Inc. disclaims any warranty of any kind, expressed or implied,
- as to its fitness for any particular use.
- */
-
- #import <sys/stat.h>
-
- // copied from <bsd/regex.h> to add extern for shlib.h
-
- #define ESIZE 512
- #define NBRA 9
-
- struct regex {
- char expbuf[ESIZE];
- char *braslist[NBRA];
- char *braelist[NBRA];
- char circf;
- char *start, *end; /* pointers to occurrence in 's' */
- };
-
- extern char *re_comp (char *string);
- extern int re_exec (char *string);
- extern int recmp (char *pattern, char *target);
- extern struct regex *re_compile (char *string, int fold);
- extern int re_match (char *string, struct regex *r);
-
- typedef struct regex regex;
-
- #ifdef KANJI
- #define ESIZEJ (512*4)
-
- struct regexJ {
- wchar_t expbuf[ESIZEJ];
- char *braslist[NBRA];
- char *braelist[NBRA];
- char circf;
- char *start, *end; /* pointers to occurrence in 's' */
- };
-
- typedef struct regexJ regexJ;
- #endif KANJI
-
- // regular expression searching
-
- inline static regex *
- IXRegexCompile(const char *s, char ignoreCase)
- {
- return re_compile((char *) s, ignoreCase);
- }
-
- extern char *IXFilenameToRegex(char *filename);
- extern const char *IXRegexMatch(const char *s, regex *r);
- extern const char *IXRegexMatchPrefix(const char *s, regex *r);
- extern const char *IXRegexMatchWord(const char *s, regex *r);
- extern const char *IXRegexMatchExactly(const char *s, regex *r);
-
- #ifdef KANJI
- extern regexJ *IXRegexCompileJ(const char *s, char ignoreCase);
- extern const char *IXRegexMatchJ(const char *s, regexJ *r);
- extern const char *IXRegexMatchPrefixJ(const char *s, regexJ *r);
- extern const char *IXRegexMatchWordJ(const char *s, regexJ *r);
- extern const char *IXRegexMatchExactlyJ(const char *s, regexJ *r);
- #endif KANJI
-
- #define IX_BMTABLESIZE 256
-
- typedef struct {
- unsigned short plength;
- unsigned char casemap[IX_BMTABLESIZE];
- unsigned short skiptab[IX_BMTABLESIZE];
- unsigned char pattern[0];
- } IXBMTable;
-
- // Boyer Moore string searching
-
- extern IXBMTable *IXBMCompile(const char *s, char ignoreCase);
- extern const char *IXBMMatch(const char *s, unsigned l, IXBMTable *t);
- extern const char *IXBMMatchPrefix(const char *s, unsigned l, IXBMTable *t);
- extern const char *IXBMMatchWord(const char *s, unsigned l, IXBMTable *t);
- extern const char *IXBMMatchExactly(const char *s, unsigned l, IXBMTable *t);
-
- #ifdef KANJI
- extern IXBMTable *IXBMCompileJ(const char *s, char ignoreCase);
- extern const char *IXBMMatchJ(const char *s, unsigned l, IXBMTable *t);
- extern const char *IXBMMatchPrefixJ(const char *s, unsigned l, IXBMTable *t);
- extern const char *IXBMMatchWordJ(const char *s, unsigned l, IXBMTable *t);
- extern const char *IXBMMatchExactlyJ(const char *s, unsigned l, IXBMTable *t);
- #endif KANJI
-